<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2021/12/7
 * Time: 9:25
 */

//根据用户名和密码查询出用户ID
function getUserIdByUserNameAndPwd($uesrname,$password){
    if($uesrname=='admin'&& $password='123456'){
        //查询数据库得知，该用户的ID为
        return  110;
    }else if($uesrname=='test'&& $password='888888'){
        //查询数据库得知，该用户的ID为
        return 200;
    }else if($uesrname=='zhangsan'&& $password='666666'){
        //查询数据库得知，该用户的ID为
        return 400;
    }else{
        echo '用户名或密码错误';die;
    }
}

//根据用户ID查询出用户名和密码
function getUserNameAndPasswordByUserId($userID){
    switch ($userID){
        case 110:
            return ['admin','123456'];
            break;
        case 200:
            return ['test','888888'];
            break;
        case 400:
            return ['zhangsan','666666'];
            break;
        default:
            return '';
    }
}